package com.xinggq.user.service.dto.user;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;

import java.time.LocalDate;

/**
 * 用户更新请求DTO
 *
 * @author xinggq
 * @since 2025-01-01
 */
@Schema(description = "用户更新请求")
public class UserUpdateRequest {

  @Schema(description = "用户ID", required = true)
  @NotNull(message = "用户ID不能为空")
  private Long id;

  @Schema(description = "用户名", example = "admin")
  @Size(min = 3, max = 50, message = "用户名长度必须在3-50个字符之间")
  @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "用户名只能包含字母、数字和下划线")
  private String username;

  @Schema(description = "邮箱", example = "admin@example.com")
  @Email(message = "邮箱格式不正确")
  @Size(max = 100, message = "邮箱长度不能超过100个字符")
  private String email;

  @Schema(description = "手机号", example = "13800138000")
  @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
  private String phone;

  @Schema(description = "真实姓名", example = "张三")
  @Size(max = 50, message = "真实姓名长度不能超过50个字符")
  private String realName;

  @Schema(description = "昵称", example = "管理员")
  @Size(max = 50, message = "昵称长度不能超过50个字符")
  private String nickname;

  @Schema(description = "性别：0-未知，1-男，2-女", example = "1")
  private Integer gender;

  @Schema(description = "生日", example = "1990-01-01")
  @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
  private LocalDate birthday;

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getUsername() {
    return username;
  }

  public void setUsername(String username) {
    this.username = username;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getPhone() {
    return phone;
  }

  public void setPhone(String phone) {
    this.phone = phone;
  }

  public String getRealName() {
    return realName;
  }

  public void setRealName(String realName) {
    this.realName = realName;
  }

  public String getNickname() {
    return nickname;
  }

  public void setNickname(String nickname) {
    this.nickname = nickname;
  }

  public Integer getGender() {
    return gender;
  }

  public void setGender(Integer gender) {
    this.gender = gender;
  }

  public LocalDate getBirthday() {
    return birthday;
  }

  public void setBirthday(LocalDate birthday) {
    this.birthday = birthday;
  }
}